#include "CocosPCH.h"
#include "CoCElementMatrix.h"

#include "Utility.h"

struct MATRIX {
	int a, b, c, d;
	int tx, ty;
};

CoCElementMatrix::CoCElementMatrix(void)
{
}


CoCElementMatrix::~CoCElementMatrix(void)
{
}

bool CoCElementMatrix::Parse(void *data, CoCSWF *pSWF)
{		
	int nDataPos = 0;
	MATRIX trans;
	Utility_ReadValue(&trans, data, &nDataPos);
	
	m_trans.a = trans.a / 1024.0f;
	m_trans.b = trans.b / 1024.0f;
	m_trans.c = trans.c / 1024.0f;
	m_trans.d = trans.d / 1024.0f;
	m_trans.tx = trans.tx / 20.0f;
	m_trans.ty = trans.ty / -20.0f;

	return true;
}

AffineTransform *CoCElementMatrix::GetMatrix()
{
	return &m_trans;
}